package com.itheima.myutil;

/**
 * @Author G_Y
 * @Date 2020/6/12 14:56
 * @Description: 自定义的简易PageHelper
 **/
public class MyPageHelper {

    public static final ThreadLocal<PageInfo> PAGE_TL = new ThreadLocal<>();

    public static void startPage(Integer pageSize, Integer pageNum){
        PageInfo pageInfo = new PageInfo(pageSize, pageNum);
        PAGE_TL.set(pageInfo);
    }
    public static PageInfo getAndRemove() {
        PageInfo pageInfo = PAGE_TL.get();
        PAGE_TL.remove();
        return pageInfo;
    }
    public static class PageInfo{
        private Integer pageSize;
        private Integer pageNum;
        public PageInfo(Integer pageSize, Integer pageNum) {
            this.pageSize = pageSize;
            this.pageNum = pageNum;
        }
        public Integer getPageSize() {
            return pageSize;
        }
        public void setPageSize(Integer pageSize) {
            this.pageSize = pageSize;
        }
        public Integer getPageNum() {
            return pageNum;
        }
        public void setPageNum(Integer pageNum) {
            this.pageNum = pageNum;
        }
    }
}
